package com.project.imageinterference.common;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;

import java.util.Collections;

/**
 * @ClassName Codegenerator
 * @Description 代码自动生成
 * @Author haochuanwan
 * @Date 2025/2/22 13:16
 **/
public class CodeGenerator {
    public static void main(String[] args) {
        FastAutoGenerator.create("jdbc:mysql://localhost:3306/image_identify", "root", "root")
                .globalConfig(builder -> {
                    builder.author("haochuanwan") // 设置作者
                            .outputDir("src/main/java"); // 输出目录
                })
                .packageConfig(builder -> {
                    builder.parent("com.project.imageinterference") // 包名
                            .pathInfo(Collections.singletonMap(OutputFile.xml, "src/main/resources/mapper")); // XML 文件路径
                })
                .strategyConfig(builder -> {
                    builder.addInclude("t_disease_identify", "t_sys_user", "t_news") // 表名
                            .entityBuilder() // 实体类配置
                            .enableLombok(); // 使用 Lombok
                })
                .execute();
    }
}